<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOperationLogsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('operation_logs', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->nullable()->comment('用户ID');
            $table->string('method', 50)->comment('方法');
            $table->text('path')->comment('路径');
            $table->string('ip')->comment('ip');
            $table->unsignedTinyInteger('type')->nullable()->comment('操作类型，1:增加,2:删除,3:修改,4:查看');
            $table->string('description')->comment('操作描述');
            $table->text('params')->comment('操作前参数');
            $table->string('client')->nullable()->comment('客户端类型');
            $table->string('browser')->nullable()->comment('浏览器类型');
            $table->string('data_scope')->nullable()->comment('数据域');
            $table->timestamps();

            $table->comment = '操作记录表';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('operation_logs');
    }

}
